﻿using Microsoft.VisualStudio.Shell;
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Task = System.Threading.Tasks.Task;

namespace DynamicMenu
{
    [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
    [Guid(DynamicMenuPackage.PackageGuidString)]
    [ProvideMenuResource("Menus.ctmenu", 1)]
    public sealed class DynamicMenuPackage : AsyncPackage
    {
        public const string PackageGuidString = "69c14e24-14c6-4e94-a3d6-822b048f3c14";

        public const string guidDynamicMenuPackageCmdSet = "f46b9bad-42a8-4ed7-bfc7-69f90f7a9866";  //从.vsct文件获取GUID
        public const uint cmdidMyCommand = 0x104;

        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
        {
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
            await DynamicMenu.InitializeAsync(this);
        }

    }
}
